package com.teach.servlet;

import com.teach.dao.CountryInfoDAO;
import com.teach.dao.impl.CountryInfoDAOImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/home.let")
public class HomeServlet extends HttpServlet {


  private CountryInfoDAO dao = new CountryInfoDAOImpl();

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    try{
      req.setAttribute("list", dao.countMedal());
      req.getRequestDispatcher("/home.jsp").forward(req, resp);
    }catch (Exception ex){
      throw new ServletException(ex.getMessage(), ex);
    }
  }
}
